package enumandlambda;

/**
 * @author shkstart
 * @create 2022-11-28-11:42
 */
public class ThreadDemo2 {
    private final static  int COUNT = 10;
    public static void main(String[] args) {
//        记录开始时间
        long stime = System.currentTimeMillis();

        //单线程进行执行
        singleThread();

//        记录结束时间
        long etime = System.currentTimeMillis();
        System.out.println("执行时间"+ (etime-stime));
    }

    /**
     * 单线程执行任务
     */
    private static void singleThread() {

        for (int i = 0; i <COUNT ; i++) {
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }

        }
    }
}
